package br.com.locanet.service.impl;

import javax.persistence.PersistenceException;

import br.com.locanet.bean.impl.Imagem;
import br.com.locanet.dao.database.impl.ImagemDAO;
import br.com.locanet.exception.ExceptionList;
import br.com.locanet.exception.InvalidAttributeException;
import br.com.locanet.service.AbstractEntityService;

public class ImagemService extends AbstractEntityService<Imagem, ImagemDAO> {
	@Override
	public void doValidateBusinessRules(Imagem entity) throws ExceptionList,
			PersistenceException, ClassNotFoundException {
		
	}
	
	@Override
	public void doValidateRequiredFields(Imagem entity) throws ExceptionList {
		ExceptionList exceptionList = new ExceptionList();
		
		if (entity.getData()==null||entity.getData().length==0)
			exceptionList.add(new InvalidAttributeException("imagemNaoInformada"));
		
		if (!exceptionList.getListaErros().isEmpty())
			throw exceptionList;
	}
}
